Skip to content

fix(core): capability filtering crashing allowed command generation - #13476

Merged
lucasfernog merged 7 commits into
devfrom
fix/capability-crash
May 22, 2025
Merged

fix(core): capability filtering crashing allowed command generation#13476
lucasfernog merged 7 commits into
devfrom
fix/capability-crash

Conversation

@lucasfernog

Copy link
Copy Markdown
Member

tauri-plugin and tauri build scripts cannot have access to the capabilities file (generated by tauri-build) and can only infer capabilities from the config path (from the env var)

tauri-plugin and tauri build scripts cannot have access to the capabilities file (generated by tauri-build) and can only infer capabilities from the config path
@lucasfernog
lucasfernog requested a review from a team as a code owner May 20, 2025 20:25
@lucasfernog
lucasfernog requested a review from Legend-Master May 20, 2025 20:25
@github-actions

github-actions Bot commented May 20, 2025

Copy link
Copy Markdown
Contributor

Package Changes Through 39938ef

There are 8 changes which include tauri-bundler with patch, tauri with minor, tauri-cli with patch, tauri-codegen with minor, tauri-utils with minor, @tauri-apps/api with minor, @tauri-apps/cli with patch, tauri-runtime-wry with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.5.0 2.6.0
tauri-utils 2.4.0 2.5.0
tauri-bundler 2.4.0 2.4.1
tauri-runtime 2.6.0 2.6.1
tauri-runtime-wry 2.6.0 2.6.1
tauri-codegen 2.2.0 2.3.0
tauri-macros 2.2.0 2.2.1
tauri-plugin 2.2.0 2.2.1
tauri-build 2.2.0 2.2.1
tauri 2.5.1 2.6.0
@tauri-apps/cli 2.5.0 2.5.1
tauri-cli 2.5.0 2.5.1

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Comment thread crates/tauri-utils/src/acl/build.rs Outdated
capabilities.extend(crate::acl::get_capabilities(&config, None, None)?);
let capabilities_file_path = out_dir.join(CAPABILITIES_FILE_NAME);
// the capabilities file only exist in the tauri-build context
if !capabilities_file_path.exists() {

@Legend-Master Legend-Master May 21, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this call be a problem when the build script re-runs? I think maybe we could move back the

  if let Some(capabilities_file_path) = pre_built_capabilities_file_path {
    if capabilities_file_path.exists() {
      let capabilities_file =
        std::fs::read_to_string(capabilities_file_path).context("failed to read capabilities")?;
      capabilities_from_files =
        serde_json::from_str(&capabilities_file).context("failed to parse capabilities")?;
    }
  }

part to tauri-codegen, and replace pre_built_capabilities_file_path param with capabilities_from_files: BTreeMap<String, Capability>, and we don't have to save the files here (this file should only be used for passing the data from tauri-build to tauri-codegen right? (maybe we should document this, I'm having a hard time revisiting this code 😂))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, it was a nightmare 🤣

@lucasfernog
lucasfernog requested a review from Legend-Master May 21, 2025 15:18
Legend-Master
Legend-Master previously approved these changes May 22, 2025
Comment thread crates/tauri-utils/src/acl/build.rs Outdated
Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
@lucasfernog
lucasfernog merged commit c8a30a6 into dev May 22, 2025
@lucasfernog
lucasfernog deleted the fix/capability-crash branch May 22, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants